package com.deloitte.payrollmgtsys.util;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class PasswordGenerator {
	
	private static final String KEY = "elgooG";
	
	public static String getPassword(String username) {
		MessageDigest md = null;
		try {
			md = MessageDigest.getInstance("MD5");
		} catch (NoSuchAlgorithmException e) {
			e.printStackTrace();
		}
		String target = username + KEY;
		md.update(target.getBytes());
		StringBuffer sb = new StringBuffer();
		for (byte b : md.digest()) {
			sb.append(String.format("%02x", b));
		}
		return sb.toString();
	}
}
